package com.nowc.week.w105_ak;

import java.io.*;

public class b {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StreamTokenizer in = new StreamTokenizer(br);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        solve();
        out.flush();
        out.close();
        br.close();
    }

    static void solve() throws IOException {
        in.nextToken(); int n = (int) in.nval;
        int[] a = new int[n];
        int[] b = new int[n - 1];
        for (int i = 0; i < n; i++) {
            in.nextToken(); a[i] = (int) in.nval;
            if (i > 0) {
                b[i - 1] = a[i] ^ a[i - 1];
            }
        }
        long ans = gcd(b[0], b[1]);
        for (int i = 2; i < n - 1; i++) {
            ans = gcd(ans, b[i]);
        }
        out.println(ans);
    }

    public static long gcd(long a, long b) {
        return b == 0 ? a : gcd(b, a % b);
    }
}
